# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=ovos-skill-manager
pkgver=0.0.13
pkgrel=1
pkgdesc="Open Voice OS skill manager (deprecated)"
url="https://github.com/OpenVoiceOS/ovos_skill_manager"
arch="noarch"
license="Apache-2.0"
depends="
	ovos-skill-installer
	py3-beautifulsoup4
	py3-click
	py3-click-default-group
	py3-combo-lock
	py3-json-database
	py3-ovos-config
	py3-ovos-utils
	py3-packaging
	py3-pako
	py3-requests
	py3-requests-cache
	py3-yaml
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/OpenVoiceOS/ovos_skill_manager/archive/refs/tags/$pkgver.tar.gz
	appstore-use-last-compatible-archive.patch
	fix-github-main-branch-detection.patch
	"
# net required for tests
options="net"
builddir="$srcdir/ovos_skill_manager-$pkgver"

# Backwards compatibility from a rename
provides="ovos-skills-manager=$pkgver-r$pkgrel"
replaces="ovos-skills-manager"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	case "$CARCH" in
	armhf)
		.testenv/bin/python3 -m pytest \
			-k 'not test_locate_config and not test_skill_entry_uuid' \
			--deselect test/unittests/test_osm.py \
			--deselect test/unittests/test_skill_entry.py::TestSkillEntryFromGit::test_requirements_commented \
			--deselect test/unittests/test_skill_entry.py::TestSkillEntryFromGit::test_requirements_from_txt \
			--deselect test/unittests/test_skill_entry.py::TestSkillEntryFromGit::test_requirements_json_manifest_txt \
			--deselect test/unittests/test_skill_entry.py::TestSkillEntryFromGit::test_requirements_json_manifest_txt_dep_system_reqs \
			--deselect test/unittests/test_skill_entry.py::TestSkillEntryFromGit::test_requirements_null_json
		;;
	*)
		.testenv/bin/python3 -m pytest \
			-k 'not test_locate_config and not test_skill_entry_uuid' \
			--deselect test/unittests/test_osm.py
		;;
	esac
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
38629a4571e1508dae5f9f66b93b76a02f4f90069a00148cc216728c91efa1a3b397131e71a83837d9447214021ea1f5a83a80bf42e8e9d2af7d8f70e847993f  ovos-skill-manager-0.0.13.tar.gz
fdd52cc7a40e2c39c63d8a1c7adab1d713f669bf08733c5bc11d3c0a248c56a23206825d2b3729c2a182fe0bb9b18492e5319bff970aa91a8f91f7ffdc69a409  appstore-use-last-compatible-archive.patch
2b6bb10b244fd1b9fbd5c76c0f3506d68d693a861eaa310df1c6ee2d5db49befb80268e2fe3720942b60c4b73d2f05b2f7a9dfce7c5c19b6e6afcdbd27926667  fix-github-main-branch-detection.patch
"
